home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_d / isamexpt.zip / ISAMTABL.PAS < prev    next >
Pascal/Delphi Source File  |  1996-04-05  |  63KB  |  2,056 lines

  1. unit Isamtabl;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, DsgnIntf,
  8.   UUseIsam, Filer, LowBrows,
  9.   Restruct, ReIndex, ExtCtrls;
  10.  
  11. type
  12.   TIsamProperty = class(TStringProperty)
  13.   public
  14.     function GetAttributes: TPropertyAttributes; override;
  15.     procedure GetValueList(List: TStrings); virtual; abstract;
  16.     procedure GetValues(Proc: TGetStrProc); override;
  17.   end;
  18.  
  19.   TIsamBrowserProperty = class(TIsamProperty)
  20.     procedure GetValueList(List: TStrings); override;
  21.   end;
  22.  
  23.   TIsamHeaderProperty = class(TIsamProperty)
  24.     procedure GetValueList(List: TStrings); override;
  25.   end;
  26.  
  27.   TIsamTable = class(TComponent)
  28.   private
  29.     FActive      : Boolean;
  30.     FAnsiConvert : Boolean;
  31.     FTableName   : TFileName;
  32.     FUnitName    : TFileName;
  33.     FIsamKey     : TStringList;
  34.     FRecordName  : String;
  35.     FRecord      : TStringList;
  36.     FIID         : TStringList;
  37.     FNetz        : NetSupportType;
  38.     FSaveModus   : Boolean;
  39.     FSourceCreate: Boolean;
  40.     FBrowserName : String;
  41.     FHeaderName  : String;
  42.     Procedure MySave;
  43.     Function Check(Name : String; SS : TStringList) : Boolean;
  44.     procedure CheckInactive;
  45.     function GetActive: Boolean;
  46.     procedure SetActive(Value: Boolean);
  47.     procedure SetTableName(const Value: TFileName);
  48.  
  49.     procedure SetRecordName(const Value: String);
  50.     Procedure SetUnitName(const Value: TFileName);
  51.     {$IFDEF CodeGen}
  52.     Procedure Uses_Einfuegen(var SourceStrings: TStringList);
  53.     Procedure Record_Einfuegen(var SourceStrings: TStringList);
  54.     Procedure Data_Einfuegen(var SourceStrings: TStringList);
  55.     Procedure Key_Deklaration_Einfuegen(var SourceStrings: TStringList);
  56.     Procedure Key_Proc_Einfuegen(var SourceStrings: TStringList);
  57.     Procedure FormCreate_Einfuegen(var SourceStrings: TStringList);
  58.     Procedure FormCreate_Fuellen(var SourceStrings: TStringList);
  59.     Procedure FormResize_Fuellen(var SourceStrings: TStringList);
  60.     Procedure FormShow_Fuellen(var SourceStrings: TStringList);
  61.     Procedure HeaderCreate_Einfuegen(var SourceStrings: TStringList);
  62.     Procedure Browser_BuildRow_Einfuegen(var SourceStrings: TStringList);
  63.     Procedure Browser_Edit_Einfuegen(var SourceStrings: TStringList);
  64.     Procedure Klammern_Loeschen(var SourceStrings: TStringList);
  65.     {$ENDIF}
  66.     Procedure SetHeaderName(const Value: String);
  67.     Procedure SetBrowserName(const Value: String);
  68.     {$IFDEF CodeGen}
  69.     Procedure SetSourceCreate(const Value: Boolean);
  70.     {$ENDIF}
  71.     Function  GetFormName(SList: TStringList): String;
  72.  
  73.   protected
  74.     Procedure SetRecord(Value: TStringList);
  75.     Procedure SetKeyProc(Value: TStringList);
  76.     Procedure SetIIDProc(Value: TStringList);
  77.     Procedure SetNetz(Value: NetSupportType);
  78.     {$IFDEF CodeGen}
  79.     Procedure BrowRow(Var SListe: TStringList;Var II : Integer);
  80.     Procedure GetFeldProc_Einfuegen(var SourceStrings : TStringList);
  81.     {$ENDIF}
  82.     Procedure SetAnsiConvert(Const Value: Boolean);
  83.   public
  84.     IFBPtr    : IsamFileBlockPtr;
  85.     Key_Proc  : KeyProc;
  86.     RecSize   : Longint;
  87.     KeyNo     : Integer;
  88.     Ref       : Longint;
  89.     Key       : IsamKeyStr;
  90.     MaxKeys   : Byte;
  91.     IID       : IsamIndDescr;
  92.     EditFormIdent: String;
  93.     constructor Create(AOwner: TComponent); override;
  94.     destructor Destroy; override;
  95.     Procedure Open;
  96.     Procedure Close;
  97.     Procedure ClearFields(var DATA,DUP);
  98.     Procedure Delete(var DATA,DUP);
  99.     Procedure Insert(var DATA,DUP);
  100.     Procedure Append(var DATA,DUP);
  101.     Procedure UpdateRecord(var DATA, DUP);
  102.     Procedure Get(var DATA, DUP);
  103.     Procedure Next(var DATA,DUP);
  104.     Function  FindKey(Var Data,Dup;var Key1 : IsamKeyStr) : Boolean;
  105.     Function  FindNearest(Var Data,Dup; Key1 : IsamKeyStr) : Boolean;
  106.     Procedure Prior(var DATA,DUP);
  107.     Procedure First(var DATA,DUP);
  108.     Procedure Last(var DATA,DUP);
  109.     Procedure CreateTable;
  110.     Function Rebuild: LongInt;
  111.     Function RecordCount: Longint;
  112.   published
  113.     property Active: Boolean read GetActive write SetActive default False;
  114.     Property AnsiConvert: Boolean read FAnsiConvert write SetAnsiConvert default True;
  115.     Property BrowserName: String read FBrowserName write SetBrowserName;
  116.     Property HeaderName: String read FHeaderName write SetHeaderName;
  117.     Property MyUnitName : TFileName read FUnitName write SetUnitName;
  118.     property TableName: TFileName read FTableName write SetTableName;
  119.     property RecordName: String read FRecordName write SetRecordName;
  120.     property IsamKeyProc: TStringList read FIsamKey write SetKeyProc;
  121.     property IsamRecord: TStringList read FRecord write SetRecord;
  122.     property Netz: NetSupportType read FNetz write SetNetz default NoNet;
  123.     property SaveModus: Boolean read FSaveModus write FSaveModus default False;
  124.     {$IFDEF CodeGen}
  125.     property SourceCreate: Boolean read FSourceCreate write SetSourceCreate default False;
  126.     {property SourceEditorCreate: Boolean read FEditorCreate write SetEditorCreate default False;}
  127.     {$ENDIF}
  128.     property AnzahlKeys: Byte read MaxKeys write MaxKeys default 1;
  129.     property IIDProc : TStringList read FIID write SetIIDProc;
  130.   end;
  131.  
  132.   var NetType: NetSupportType;
  133.  
  134. implementation
  135.  
  136. Uses UToolDll, ExptIntf,
  137.      FvcBrows, IsamBrow, Proxies, Dat;
  138.  
  139. var FHandle: Longint;
  140.     MyNet  : NetSupportType;
  141.  
  142. function TIsamProperty.GetAttributes: TPropertyAttributes;
  143. begin
  144.   Result := [paValueList, paSortList, paMultiSelect, paReadOnly];
  145. end;
  146.  
  147. procedure TIsamProperty.GetValues(Proc: TGetStrProc);
  148. var
  149.   I: Integer;
  150.   Values: TStringList;
  151. begin
  152.   Values := TStringList.Create;
  153.   try
  154.     GetValueList(Values);
  155.     for I := 0 to Values.Count - 1 do Proc(Values[I]);
  156.   finally
  157.     Values.Free;
  158.   end;
  159. end;
  160.  
  161. procedure TIsamBrowserProperty.GetValueList(List: TStrings);
  162. var I: Integer;
  163.     Component: TComponent;
  164. begin
  165.   i:= 0;
  166.   While I < Designer.Form.ComponentCount do begin
  167.     Component := Designer.Form.Components[I];
  168.     if (Component is TIsamBrowser)
  169.     and (Component.Name <> '') then List.Add(Component.Name);
  170.     Inc(i);
  171.   end;
  172. end;
  173.  
  174. procedure TIsamHeaderProperty.GetValueList(List: TStrings);
  175. var I: Integer;
  176.     Component: TComponent;
  177. begin
  178.   i:= 0;
  179.   While I < Designer.Form.ComponentCount do begin
  180.     Component := Designer.Form.Components[I];
  181.     if (Component is THeader) and (Component.Name <> '') then List.Add(Component.Name);
  182.     Inc(i);
  183.   end;
  184. end;
  185.  
  186. constructor TIsamTable.Create(AOwner: TComponent);
  187. begin
  188.   inherited Create(AOwner);
  189.   FAnsiConvert:= True;
  190.   IFBPTR:= NIL;
  191.   RecSize:= 0;
  192.   KeyNo:= 1;
  193.   Ref:= 0;
  194.   Key_Proc:= NIL;
  195.   FTableName:= '';
  196.   FRecordName:= '';
  197.   MaxKeys := 1;
  198.   FIsamKey:= TStringList.Create;
  199.   FRecord:= Tstringlist.create;
  200.   FIID := TStringList.Create;
  201. {$Ifdef Test}
  202.   FIsamKey.Add('Function '+FRecordName+'KeyProc(Var Daten; KeyNr:Word): IsamKeyStr;');
  203.   FIsamKey.Add('var s : String;');
  204.   FIsamKey.Add('begin');
  205.   FIsamKey.Add('  s:= '+Chr(39)+Chr(39)+';');
  206.   FIsamKey.Add('  with '+FRecordName+'(Daten) do begin');
  207.   FIsamKey.Add('    case KeyNr of');
  208.   FIsamKey.Add('      1 : S:= '+Chr(39)+Chr(39)+';');
  209.   FIsamKey.Add('    End;');
  210.   FIsamkey.Add('  end;');
  211.   FIsamKey.Add('  KeyProc:= s;');
  212.   FIsamkey.Add('end;');
  213.   FIsamkey.Add('');
  214.  
  215.   FRecord.Add('Type');
  216.   FRecord.Add(FRecordName+' = Record');
  217.   FRecord.add('  Dummy : Longint;');
  218.   FRecord.add('end;');
  219. {$Endif}
  220.   if (csDesigning in ComponentState) then
  221.   if Toolservices <> NIL then
  222.   begin
  223.     FIsamKey.Add('Function '+FRecordName+'KeyProc(Var Daten; KeyNr:Word): IsamKeyStr;');
  224.     FIsamKey.Add('var s : String;');
  225.     FIsamKey.Add('begin');
  226.     FIsamKey.Add('  s:= '+Chr(39)+Chr(39)+';');
  227.     FIsamKey.Add('  with '+FRecordName+'(Daten) do begin');
  228.     FIsamKey.Add('    case KeyNr of');
  229.     FIsamKey.Add('      1 : S:= '+Chr(39)+Chr(39)+';');
  230.     FIsamKey.Add('    End;');
  231.     FIsamkey.Add('  end;');
  232.     FIsamKey.Add('  KeyProc:= s;');
  233.     FIsamkey.Add('end;');
  234.     FIsamkey.Add('');
  235.  
  236.     FRecord.Add('Type');
  237.     FRecord.Add(FRecordName+' = Record');
  238.     FRecord.add('  Dummy : Longint;');
  239.     FRecord.add('end;');
  240.   end;
  241.   if (csDesigning in ComponentState) then
  242.   if Toolservices <> NIL then
  243.   begin
  244.     if FUnitName = '' then
  245.     begin
  246.       {if not ToolServices.SaveProject then ErrorWindow('Project konnte nicht',
  247.                                                        'gespeichert werden');  }
  248.       FUnitName := ToolServices.GetUnitName(ToolServices.GetUnitCount);
  249.     end;
  250.   end;
  251.   if (csdesigning in componentstate) then begin
  252.     GetFHandle(FHandle);
  253.   end;
  254.   EditFormIdent:= '';
  255. end;
  256.  
  257. destructor TIsamTable.Destroy;
  258. begin
  259.   CheckInactive;
  260.   FIsamKey.Free;
  261.   FRecord.Free;
  262.   FIID.Free;
  263.   inherited Destroy;
  264. end;
  265.  
  266. Function TIsamTable.GetFormName(SList: TStringList): String;
  267. var S: Integer;
  268.     SStr: String;
  269.     Gefunden: Boolean;
  270. begin
  271.   S:= 0;
  272.   SStr:= '';
  273.   Gefunden:= False;
  274.   While (S < SList.Count) and (Gefunden = False) do begin
  275.     SStr:= UpperCase(SList[S]);
  276.     Strip(SStr);
  277.     if Pos('=CLASS',SStr) > 0 then Gefunden:= True
  278.     else Inc(S);
  279.   end;
  280.   If Gefunden then begin
  281.     SStr:= Copy(SStr,1,Pos('=CLASS',SStr)-1);
  282.   end
  283.   else SStr:= '';
  284.   Result:= SStr;
  285. end;
  286.  
  287. {$IFDEF CodeGen}
  288. Procedure GetArray(AStr: String; var Arr1,Arr2: Integer);
  289. var A1Str: String;
  290.     A1,A2,Code: Integer;
  291. begin
  292.   Arr1:= 1;
  293.   Arr2:= 1;
  294.   if (Pos('ARRAY[',AStr) > 0) and (Pos('CHAR',Astr) = 0) then begin
  295.     Delete(AStr,1,Pos('ARRAY[',AStr)+5);
  296.     if Pos(']',AStr) > 0 then begin
  297.       AStr:= Copy(AStr,1,Pos(']',AStr)-1);
  298.       if Pos('.',AStr) > 0 then begin
  299.         A1Str:= Copy(AStr,1,Pos('.',AStr)-1);
  300.         While (Pos('.',AStr) > 0) do Delete(AStr,1,Pos('.',AStr));
  301.         Strip(a1Str); Strip(AStr);
  302.         Val(A1Str,A1,Code);
  303.         Val(AStr,A2,Code);
  304.         if (A1 > 0) and (A2 > 0) then begin
  305.           Arr1:= A1;
  306.           Arr2:= A2;
  307.           if Arr1 > Arr2 then begin
  308.             A1:= Arr2;
  309.             Arr2:= Arr1;
  310.             Arr1:= A1;
  311.           end;
  312.         end;
  313.       end;
  314.     end;
  315.   end;
  316. end;
  317.  
  318. Function GetBrowserString(NStr: String; Arr: Integer): String;
  319. var S,FeldName,AStr: String;
  320. begin
  321.   S:= '';
  322.   FeldName:= Copy(NStr,1,Pos(':',NStr)-1);
  323.   Strip(FeldName);
  324.   if Arr > 0 then begin
  325.     Str(Arr,AStr);
  326.     FeldName:= FeldName+'['+AStr+']';
  327.   end;
  328.   if (Length(FeldName) > 0) and (Pos('DUMMY',NStr) = 0) and (Pos('MEMO',NStr) = 0) then begin
  329.     if Pos('WORD',NStr) > 0 then S:= 'DateStr('+FeldName+')'
  330.     else if Pos('INTEGER',NStr) > 0 then S:= 'IntStr('+FeldName+')'
  331.     else if Pos('BYTE',NStr) > 0 then S:= 'IntStr('+FeldName+')'
  332.     else if Pos('LONGINT',NStr) > 0 then S:= 'DateStr('+FeldName+')'
  333.     else if Pos('REAL',NStr) > 0 then S:= 'FormDezStr('+FeldName+',10,2)'
  334.     else S:= 'String_oem2ansi(Table.AnsiConvert,'+FeldName+')'
  335.   end;
  336.   GetBrowserString:= S;
  337. end;
  338.  
  339. Procedure TIsamTable.BrowRow(Var SListe: TStringList; VAR II:Integer);
  340. Var NStr   : String;
  341.     A,Feld,x,Arr1,Arr2: Integer;
  342.     BStr,FeldName: String;
  343.     s      : String;
  344. begin
  345.   S := '';
  346.   if IsamRecord.Count > 0 then begin
  347.     Feld:= 0;
  348.     For x:= 0 to IsamRecord.Count-1 do begin
  349.       NStr:= IsamRecord[x];
  350.       NStr:= Uppercase(NStr);
  351.       Strip(NStr);
  352.       if (Pos(':',NStr) > 0) then begin
  353.         GetArray(NStr,Arr1,Arr2);
  354.         if Arr1 = Arr2 then begin
  355.           A:= 0;
  356.           BStr:= GetBrowserString(NStr,A);
  357.           if BStr <> '' then begin
  358.             Inc(Feld);
  359.             SListe.Insert(ii,'      '+DezStr(Feld)+': s:= '+BStr+'+'+Chr(39)+'^'+Chr(39)+';');
  360.             Inc(ii);
  361.           end;
  362.         end
  363.         else begin
  364.           For a:= arr1 to Arr2 do begin
  365.             BStr:= GetBrowserString(NStr,A);
  366.             if BStr <> '' then begin
  367.               Inc(Feld);
  368.               SListe.Insert(ii,'      '+DezStr(Feld)+': s:= '+BStr+'+'+Chr(39)+'^'+Chr(39)+';');
  369.               Inc(ii);
  370.             end;
  371.           end;
  372.         end;
  373.       end;
  374.     end;
  375.   end;
  376. end;
  377. {$ENDIF}
  378.  
  379. Function TIsamTable.Check(Name:String; SS:TStringList) : Boolean;
  380. Var
  381.   SStr : String;
  382.   i    : word;
  383. begin
  384.   i := 0;
  385.   Name := UpperCase(Name);
  386.   Strip(Name);
  387.   Check := True;
  388.   if SS.Count > 0 then
  389.   repeat
  390.     SStr:= SS[i];
  391.     SStr:= Uppercase(SStr);
  392.     Strip(SStr);
  393.     if Pos(Name,SStr) > 0 then exit;
  394.     inc(i);
  395.   Until (i >= SS.Count);
  396.   Check := False;
  397. end;
  398.  
  399. Procedure TIsamTable.MySave;
  400. begin
  401.   if ToolServices <> NIL then begin
  402.     ToolServices.ReloadFile(FUnitName);
  403.     Toolservices.SaveFile(FUnitName);
  404.     if not ToolServices.SaveProject then begin
  405.       if Sprache = 1 then Errorwindow('Project could not be saved.','')
  406.       else ErrorWindow('Project konnte nicht','gespeichert werden.');
  407.     end;
  408.   end
  409.   else Errorwindow('TOOLSERVICES not assigned','');
  410. end;
  411.  
  412. Procedure TIsamTable.SetAnsiConvert(Const Value: Boolean);
  413. begin
  414.   FAnsiConvert:= Value;
  415. end;
  416.  
  417. Procedure TIsamTable.SetNetz(Value: NetSupportType);
  418. begin
  419.   FNetz:= Value;
  420. end;
  421.  
  422. Procedure TIsamTable.CheckInactive;
  423. begin
  424.   Active:= False;
  425. end;
  426.  
  427. function TIsamTable.GetActive: Boolean;
  428. begin
  429.   Result := (FActive = True);
  430. end;
  431.  
  432. Procedure TIsamTable.SetUnitName (Const Value:TFileName);
  433. begin
  434.   FunitName := Value;
  435.   if (csDesigning in ComponentState) then
  436.   if Toolservices <> NIL then
  437.   if Value <> FUnitName then
  438.   begin
  439.     if Sprache = 1 then begin
  440.       if Janein('Unitname changed, reload?','New: '+Value+' FUnitName: '+FUnitName) then
  441.       FUnitName := ToolServices.GetUnitName(ToolServices.GetUnitCount);
  442.     end
  443.     else begin
  444.       if Janein('Unitname geΣndert, neu einlesen?','Neu: '+Value+' FUnitName: '+FUnitName) then
  445.       FUnitName := ToolServices.GetUnitName(ToolServices.GetUnitCount);
  446.     end;
  447.   end;
  448. end;
  449.  
  450. procedure TIsamTable.SetActive(Value: Boolean);
  451. var AllesOk : Boolean;
  452. begin
  453.   AllesOk := True;
  454.   if FActive <> Value then begin
  455.     if Value then begin
  456.       if TableName <> '' then begin
  457.         if BtFileBlockIsOpen(IFBPtr) then begin
  458.           if Sprache = 1 then Errorwindow('Isamtable '+__Laufwerk+TableName,'is already opened')
  459.           else Errorwindow('Die Isamdatei: '+__Laufwerk+TableName,'ist bereits ge÷ffnet');
  460.           FActive := True;
  461.           Value := True;
  462.           AllesOk := False;
  463.         end else
  464.         begin
  465.           FActive := False;
  466.           if MyNet <> NoNet then Netz := MYNet;
  467.           InitIsam(Netz);
  468.           {ST}
  469.           if not ExistIsam(IFBPtr,__LAUFWERK+TableName) then
  470.           {New Function in UUSeIsam, will testing IsamTableExist}
  471.           begin
  472.             if Sprache = 1 then Errorwindow('Isamtable '+__Laufwerk+TableName+' does not exist in the active path','')
  473.             else Errorwindow('Isamtabelle: '+__Laufwerk+TableName+' existiert nicht im angegebenen Directory !','');
  474.             FActive := False;
  475.             Value  := False;
  476.             AllesOk := False;
  477.             exit;
  478.           end;
  479.           {ST end}
  480.           if RecSize = 0 then begin
  481.             if Sprache = 1 then Errorwindow('Isamtable will be opened local','')
  482.             else Errorwindow('Die Isamdatei wird lokal','ge÷ffnet');
  483.             BTOpenFileBlock(IFBPtr,__Laufwerk+TableName,False,False,SaveModus,False);
  484.             Diee;
  485.             if ISAMOK then FActive:= True else AllesOk := False;
  486.           end
  487.           else begin
  488.             if not(csDesigning in ComponentState) then begin
  489.               GetFHandle(FHandle);
  490.             end;
  491.             DateiOeffnen (IFBPtr,__Laufwerk+TableName,SaveModus,RecSize);
  492.             DIEE;
  493.             if ISAMOK then FActive:= True else AllesOk := False;
  494.           end;
  495.         end;
  496.       end
  497.       else begin
  498.         if Sprache = 1 then Errorwindow('no tablename assigned','')
  499.         else Errorwindow('kein Tabellenname angegeben','');
  500.       end;
  501.     end
  502.     else begin
  503.       if BtFileBlockIsOpen(IFBPtr) then begin
  504.         DateiSchliessen(IFBPtr);
  505.         DIEE;
  506.       end;
  507.       FActive:= False;
  508.       ExitIsam;
  509.     end;
  510.   end;
  511.   if not AllesOk then begin
  512.     if Sprache = 1 then Errorwindow('SETACTIVE-Error','Last ISAMERROR: '+DezStr(IsamError))
  513.     else Errorwindow('In SetActive ist ein Fehler aufgetreten',
  514.                       'letzter IsamError: '+DezStr(IsamError));
  515.   end;
  516. end;
  517.  
  518. procedure TIsamTable.SetTableName(const Value: TFileName);
  519. var S: String;
  520. begin
  521.   CheckInactive;
  522.   S:= Value;
  523.   if Pos('.',S) > 0 then begin
  524.     S:= Copy(S,1,Pos('.',S)-1);
  525.   end;
  526.   While Pos('\',S) > 0 do begin
  527.     S:= Copy(S,Pos('\',S)+1,Length(S));
  528.   end;
  529.   FTableName := S;
  530. end;
  531.  
  532. procedure TIsamTable.SetRecordName(Const Value: String);
  533. var i: Integer;
  534.     Gefunden: Boolean;
  535.     SStr: String;
  536. begin
  537.   if FRecordName <> Value then begin
  538.     FRecordName := Value;
  539.     if (csdesigning in componentstate) then begin
  540.       {if Owner is TForm then begin
  541.         if TForm(Owner).Designer <> NIL then TForm(Owner).Designer.Modified;
  542.       end;}
  543.       i:= 0;
  544.       Gefunden:= False;
  545.       While (i < FIsamKey.Count) and (Gefunden = False) do begin
  546.         SStr:= UpperCase(FIsamKey[i]);
  547.         Strip(SStr);
  548.         if (Pos('(DATEN)',SStr) > 0) then Gefunden:= True
  549.         else Inc(i);
  550.       end;
  551.       if Gefunden then begin
  552.         FIsamKey[i]:= '  with '+FRecordName+'(Daten) do begin';
  553.       end;
  554.       i:= 0;
  555.       Gefunden:= False;
  556.       While (i < FRecord.Count) and (Gefunden = False) do begin
  557.         SStr:= UpperCase(FRecord[i]);
  558.         Strip(SStr);
  559.         if (Pos('=RECORD',SStr) > 0) then Gefunden:= True
  560.         else Inc(i);
  561.       end;
  562.       if Gefunden then begin
  563.         FRecord[i]:= FRecordName+' = Record';
  564.       end;
  565.     end;
  566.   end;
  567. end;
  568.  
  569.  
  570. Procedure TIsamTable.SetRecord(Value: TStringList);
  571. begin
  572.   FRecord.Assign(Value);
  573. end;
  574.  
  575.  
  576. Procedure TIsamTable.SetBrowserName(Const Value: String);
  577. begin
  578.   if FBrowserName <> Value then
  579.   begin
  580.     FBrowserName:= Value;
  581.   end;
  582. end;
  583.  
  584.  
  585. Procedure TIsamTable.SetHeaderName(Const Value: String);
  586. begin
  587.   if FHeaderName <> Value then
  588.   begin
  589.     FHeaderName := Value;
  590.   end;
  591. end;
  592.  
  593. Procedure TIsamTable.SetKeyProc(Value: TStringList);
  594. begin
  595.   FIsamKey.Assign(Value);
  596. end;
  597.  
  598. Procedure TIsamTable.SetIIDProc(Value: TStringList);
  599. begin
  600.   FIID.Assign(Value);
  601. end;
  602.  
  603. {$IFDEF CodeGen}
  604. Procedure TIsamTable.Klammern_Loeschen(Var SourceStrings : TStringList);
  605. Var
  606.   I : Integer;
  607.   S : STring;
  608. begin
  609.   if BrowserName = '' then exit;
  610.   if HeaderName =  '' then exit;
  611.   I := 0;
  612.   Repeat
  613.     S:= SourceStrings[I];
  614.     if Pos('{}',S) > 0 then SourceStrings.Delete(i)
  615.     else Inc(I);
  616.   Until i >= SourceStrings.Count;
  617. end;
  618. {$ENDIF}
  619.  
  620. Procedure TIsamTable.Open;
  621. begin
  622.   Active:= True;
  623. end;
  624.  
  625. Procedure TIsamTable.Close;
  626. begin
  627.   CheckInactive;
  628. end;
  629.  
  630. {
  631.   FindFirst  = 0;
  632.   FindLast   = 1;
  633.   FindNext   = 2;
  634.   FindPrev   = 3;
  635.   FindALL    = 4;
  636. }
  637.  
  638. Procedure TIsamTable.First(var DATA, DUP);
  639. begin
  640.   if Active then begin
  641.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,0);
  642.     DIEE;
  643.     if ISAMOK then begin
  644.       SatzLesen (IFBPtr,Ref,Data,Dup);
  645.       DIEE;
  646.     end;
  647.   end;
  648. end;
  649.  
  650. Procedure TIsamTable.CreateTable;
  651. Var Act : Boolean;
  652.     Txt1,Txt2: String;
  653. begin
  654.   Act := Active;
  655.   if Active then Close;
  656.   if Sprache = 1 then begin
  657.     Txt1:= 'Table '+__Laufwerk+TableName+' already exists.';
  658.     Txt2:= 'overwrite ?';
  659.   end
  660.   else begin
  661.     Txt1:= 'IsamTabelle '+__Laufwerk+TableName+' existiert schon.';
  662.     Txt2:= '▄berschreiben ?';
  663.   end;
  664.   if exist(__Laufwerk+TableName+'.Dat') then if not Janein(Txt1,Txt2) then
  665.   begin
  666.     if Act then Open;
  667.     exit;
  668.   end;
  669.   if MyNet <> NoNet then Netz := MYNet;
  670.   InitIsam(Netz);
  671.   if RecSize = 0 then begin
  672.     if Sprache = 1 then Errorwindow('No recordsize assigned','')
  673.     else Errorwindow('Recordgr÷▀e ist nicht angegeben','');
  674.   end
  675.   else begin
  676.     BTCREATEFileBlock(__Laufwerk+TableName,RecSize, MaxKeys, IID);
  677.     DIEE;
  678.   end;
  679.   ExitIsam;
  680.   if Act then Open;
  681. end;
  682.  
  683. {$F+}
  684. Procedure DisplayRebuildInfo (     KeyNr   : Integer;
  685.                                    NrRead,
  686.                                    NrWrite : LongInt;
  687.                                Var DatS;
  688.                                    Len     : Word );
  689.  
  690. Begin
  691.   Waitwindow('KeyNr.: '+DezStr(KeyNr),
  692.              'NrRead: '+DezStr(NrRead)+' NrWrite: '+DezStr(NrWrite));
  693. End;
  694. {$F-}
  695.  
  696. Function TIsamTable.Rebuild: LongInt;
  697. Const
  698.   MsgFileCreated : Boolean = True;
  699. Var Act: Boolean;
  700. begin
  701.   if TableName = '' then begin
  702.     if Sprache = 1 then Errorwindow('No tablename assigned','')
  703.     else Errorwindow('Tabellenname wurde nicht angegeben','')
  704.   end
  705.   else begin
  706.     Act:= Active;
  707.     if Active then Close;
  708.     if Sprache = 1 then WaitWindow('Reorg starts','')
  709.     else WaitWindow('Reorg beginnt','');
  710.     if MyNet <> NoNet then Netz := MYNet;
  711.     InitIsam(Netz);
  712.     IsamReXUserProcPtr := {@}DisplayRebuildInfo;
  713.     ReIndexFileBlock (__Laufwerk+TableName,
  714.                       MaxKeys,
  715.                       IID ,
  716.                       False,
  717.                       Key_Proc,
  718.                       False,
  719.                       MsgFileCreated,
  720.                       BTNoCharConvert,
  721.                       Nil);
  722.     ExitIsam;
  723.     CloseWait;
  724.     if Act then Open;
  725.   end;
  726.   Rebuild := IsamError;
  727. end;
  728.  
  729. Procedure TIsamTable.Insert(var DATA, DUP);
  730. begin
  731.   if Active then begin
  732.     SatzAnlegen (IFBPtr,Data,Key_Proc);
  733.     DIEE;
  734.     Get(DATA,DUP);
  735.   end;
  736. end;
  737.  
  738. Procedure TIsamTable.Append(var DATA, DUP);
  739. begin
  740.   if Active then begin
  741.     SatzAnlegen (IFBPtr,Data,Key_Proc);
  742.     DIEE;
  743.     Get(DATA,DUP);
  744.   end;
  745. end;
  746.  
  747. Procedure TIsamTable.UpdateRecord(var DATA, DUP);
  748. var Ok: Boolean;
  749. begin
  750.   if Active then begin
  751.     SatzAendern(IFBPtr,Ref,DATA,DUP,Key_Proc,Ok);
  752.     DIEE;
  753.     Get(DATA,DUP);
  754.   end;
  755. end;
  756.  
  757. Procedure TIsamTable.Get(var DATA, DUP);
  758. begin
  759.   if Active then begin
  760.     SatzLesen (IFBPtr,Ref,Data,Dup);
  761.     DIEE;
  762.     Key:= Key_Proc(DATA,KeyNo);
  763.   end;
  764. end;
  765.  
  766. Procedure TIsamTable.Last(var DATA, DUP);
  767. begin
  768.   if Active then begin
  769.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,1);
  770.     DIEE;
  771.     if ISAMOK then begin
  772.       SatzLesen (IFBPtr,Ref,Data,Dup);
  773.       DIEE;
  774.     end;
  775.   end;
  776. end;
  777.  
  778. Procedure TIsamTable.ClearFields(var DATA, DUP);
  779. begin
  780.   if Active then begin
  781.     Fillchar(Data,Sizeof(Data),0);
  782.     Fillchar(Dup,Sizeof(Dup),0);
  783.   end;
  784. end;
  785.  
  786. Procedure TIsamTable.Delete(var DATA, DUP);
  787. Var ok,
  788.     Found : Boolean;
  789.     Key1  : ISamKeyStr;
  790.     Txt1  : String;
  791. begin
  792.   if Active then begin
  793.     Key1 := Key_Proc(Data,KeyNo);
  794.     KeySuchen (IFBPtr,KeyNo,Ref,Key1,Found);
  795.     Diee;
  796.     if Found then begin
  797.       {
  798.       if Sprache = 1 then Txt1:= 'Delete '+Key1+' ?'
  799.       else Txt1:= 'Datensatz '+Key1+' l÷schen ?';
  800.       if Janein(Txt1,'') then
  801.       }
  802.       begin
  803.         Satzloeschen(IFBPtr,Ref,Dup,Key_Proc,OK);
  804.         DIEE;
  805.       end;
  806.     end else begin
  807.       if Sprache = 1 then Errorwindow('Record not found','')
  808.       else Errorwindow('DatenSatz nicht gefunden!','');
  809.     end;
  810.   end
  811.   else begin
  812.     if Sprache = 1 then Errorwindow('Table is not opened','')
  813.     else Errorwindow('Tabelle ist nicht aktiv','');
  814.   end;
  815. end;
  816.  
  817. Procedure TIsamTable.Next(var DATA, DUP);
  818. begin
  819.   if Active then begin
  820.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,2);
  821.     DIEE;
  822.     if ISAMOK then begin
  823.       SatzLesen (IFBPtr,Ref,Data,Dup);
  824.       DIEE;
  825.     end;
  826.   end;
  827. end;
  828.  
  829. Function TIsamTable.FindKey(Var Data,Dup;var Key1 : IsamKeyStr) : Boolean;
  830. Var Found : Boolean;
  831. begin
  832.   Found := False;
  833.   if Active then begin
  834.     KeySuchen (IFBPtr,KeyNo,Ref,Key1,Found);
  835.     Diee;
  836.     if Found then
  837.     begin
  838.       SatzLesen (IFBPtr,Ref,Data,Dup);
  839.       DIEE;
  840.       Key1:= Key_Proc(Data,KeyNo);
  841.       Key:= Key1;
  842.     end;
  843.   end;
  844.   FindKey := Found;
  845. end;
  846.  
  847. Function TIsamTable.FindNearest(Var Data,Dup; Key1 : IsamKeyStr) : Boolean;
  848. Var Found : Boolean;
  849. begin
  850.   Found := False;
  851.   if Active then begin
  852.     KeySuchen (IFBPtr,KeyNo,Ref,Key1,Found);
  853.     Diee;
  854.     SatzLesen (IFBPtr,Ref,Data,Dup);
  855.     DIEE;
  856.     Found := True;
  857.   end;
  858.   FindNearest := Found;
  859. end;
  860.  
  861. Procedure TIsamTable.Prior(var Data,Dup);
  862. begin
  863.   if Active then begin
  864.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,3);
  865.     DIEE;
  866.     if ISAMOK then begin
  867.       SatzLesen (IFBPtr,Ref,Data,Dup);
  868.       DIEE;
  869.     end;
  870.   end;
  871. end;
  872.  
  873. Function TIsamTable.RecordCount: Longint;
  874. begin
  875.   if IFBPTR <> NIL then Result:= BtUsedRecs(IFBPtr)
  876.   else Result:= 0;
  877. end;
  878.  
  879. {$IFDEF CodeGen}
  880. Procedure TIsamTable.Uses_Einfuegen(var SourceStrings: TStringList);
  881. {ok}
  882. var SrceStr,SStr: String;
  883.     Gef1,Gef2,Gef3: Boolean;
  884.     S : Integer;
  885. begin
  886.   S:= 0;
  887.   Gef1:= False;
  888.   Gef2:= False;
  889.   Gef3:= False;
  890.   Repeat
  891.     SrceStr:= SourceStrings[S];
  892.     SStr:= Uppercase(SrceStr);
  893.     Strip(SStr);
  894.     Inc(S);
  895.   Until (Pos('USES',SStr) > 0) or (S >= SourceStrings.Count);
  896.   if Pos('USES',SStr) > 0 then begin
  897.     Repeat
  898.       SrceStr:= SourceStrings[S];
  899.       SStr:= Uppercase(SrceStr);
  900.       Strip(SStr);
  901.       if Pos('FILER',SStr) > 0 then Gef1:= True;
  902.       if Pos('UUSEISAM',SStr) > 0 then Gef2:= True;
  903.       if (Pos('LOWBROWS',SStr) > 0) or (BrowserName = '') then Gef3:= True;
  904.       Inc(S);
  905.     Until (Pos(';',SStr) > 0) or (S >= SourceStrings.Count);
  906.     Dec(S);
  907.     if Gef1 = False then begin
  908.       SrceStr:= SourceStrings[S];
  909.       System.Delete(SrceStr,Length(SrceStr),1);
  910.       SrceStr:= SrceStr + ','+#13+#10+'  Filer;';
  911.       SourceStrings[S]:= SrceStr;
  912.     end;
  913.     if Gef2 = False then begin
  914.       SrceStr:= SourceStrings[S];
  915.       System.Delete(SrceStr,Length(SrceStr),1);
  916.       SrceStr:= SrceStr + ', UUseIsam;';
  917.       SourceStrings[S]:= SrceStr;
  918.     end;
  919.     if Gef3 = False then begin
  920.       SrceStr:= SourceStrings[S];
  921.       System.Delete(SrceStr,Length(SrceStr),1);
  922.       SrceStr:= SrceStr + ', LowBrows;';
  923.       SourceStrings[S]:= SrceStr;
  924.     end;
  925.   end;
  926.   S := 0;
  927.   Repeat
  928.     SrceStr:= SourceStrings[S];
  929.     SStr:= Uppercase(SrceStr);
  930.     Strip(SStr);
  931.     Inc(S);
  932.   Until (Pos('IMPLEMENTATION',SStr) > 0) or (S >= SourceStrings.Count);
  933.   Repeat
  934.     SrceStr:= SourceStrings[S];
  935.     SStr:= Uppercase(SrceStr);
  936.     Strip(SStr);
  937.     Inc(S);
  938.   Until (Pos('USES',SStr) > 0) or (Pos('{$R*.DFM}',SStr) > 0) or (S >= SourceStrings.Count);
  939.   if Pos('USES',SStr) = 0 then begin
  940.     Dec(S);
  941.     SrceStr:= 'Uses SysUtils, UToolDll, Isam_Key, IsamSuch;';
  942.     SourceStrings.Insert(S,SrceStr);
  943.   end
  944.   else begin
  945.     Gef1:= False;
  946.     Dec(S);
  947.     if Pos('UTOOLDLL',SStr) > 0 then Gef1:= True;
  948.     if Gef1 = False then begin
  949.       SrceStr:= SourceStrings[S];
  950.       System.Delete(SrceStr,Length(SrceStr),1);
  951.       SrceStr:= SrceStr + ', UTOOLDLL;';
  952.       SourceStrings[S]:= SrceStr;
  953.     end;
  954.   end;
  955. end;
  956.  
  957. Procedure TIsamTable.Record_Einfuegen(var SourceStrings : TStringList);
  958. {ok}
  959. var RStr,RecStr,SStr,SrceStr: String;
  960.     S,R : Integer;
  961.     RecStrings : TStringList;
  962. begin
  963.   S := 0;
  964.   R := 0;
  965.   if FRecord = Nil then exit;
  966.   RecStrings := TStringList.Create;
  967.   RecStrings.Assign(FRecord);
  968.   R := 0;
  969.   if RecStrings.Count > 0 then
  970.   begin
  971.     Repeat
  972.       RStr := RecStrings[R];
  973.       RStr := UpperCase(RStr);
  974.       if Pos(UpperCase(FRecordName),RStr) = 0 then RecStrings.Delete(R)
  975.       else inc(R);
  976.     Until (Pos(UpperCase(FRecordName),RStr) > 0) or (R >= RecStrings.Count);
  977.   end else
  978.   begin
  979.     RecStrings.Free;
  980.     exit;
  981.   end;
  982.   R := 0;
  983.   if RecStrings.Count > 0 then begin
  984.     Repeat
  985.       RStr := RecStrings[R];
  986.       RStr := UpperCase(RStr);
  987.       if Pos(UpperCase(FRecordName),RStr) = 0 then RecStrings.Delete(R) else
  988.       inc(R);
  989.     Until (Pos(UpperCase(FRecordName),RStr) > 0) or (R >= RecStrings.Count);
  990.   end;
  991.   Repeat
  992.     {Zuersteinmal l÷schen}
  993.     SrceStr:= SourceStrings[S];
  994.     SStr:= Uppercase(SrceStr);
  995.     Strip(SStr);
  996.     if Pos(Uppercase(FRecordName)+'=RECORD',SStr) > 0 then
  997.     begin
  998.       if Sprache = 1 then SErrorwindow(FRECORDNAME+' deleted','')
  999.       else Serrorwindow(FRECORDNAME+' wird gel÷scht','');
  1000.       Repeat
  1001.         SourceStrings.Delete(S);
  1002.         SrceStr:= SourceStrings[S];
  1003.         SStr:= Uppercase(SrceStr);
  1004.         Strip(SStr);
  1005.       Until(Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1006.       if (Pos('END;',SStr) > 0) then SourceStrings.Delete(S);
  1007.     end;
  1008.     Inc(S);
  1009.   Until (Pos('=CLASS',SStr) > 0) or (S >= SourceStrings.Count);
  1010.   S := 0;
  1011.   Repeat
  1012.     SrceStr:= SourceStrings[S];
  1013.     SStr:= Uppercase(SrceStr);
  1014.     Strip(SStr);
  1015.     Inc(S);
  1016.   Until (Pos('=CLASS',SStr) > 0) or (S >= SourceStrings.Count);
  1017.  
  1018.   if (Pos('=CLASS',SStr) > 0) and (RecStrings.Count > 0) then begin
  1019.     if Sprache = 1 then SErrorwindow('Create new record ',FRecordName)
  1020.     else SErrorwindow('Record neu aufbauen',FrecordName);
  1021.     Dec(S);
  1022.     Dec(R);
  1023.     Repeat
  1024.       RecStr := RecStrings[R];
  1025.       if Pos('RECORD',UpperCase(RecStr)) = 0 then
  1026.       RecStr:= Copy(RecStr,1,Pos(';',RecStr));
  1027.       RecStr := Delspace(RecStr);
  1028.       RecStr := '  '+RecStr;
  1029.       RStr:= Uppercase(RecStr);
  1030.       Strip(RStr);
  1031.       Inc(R);
  1032.       if Delspace(RecStr) <> '' then begin
  1033.         SourceStrings.Insert(S,RecStr);
  1034.         Inc(S);
  1035.       end;
  1036.     Until (Pos('END;',RStr) > 0) or (R >= RecStrings.Count);
  1037.   end;
  1038.   RecStrings.Free;
  1039. end;
  1040.  
  1041. Procedure TIsamTable.Data_Einfuegen(var SourceStrings: TStringList);
  1042. {ok}
  1043. var SStr,
  1044.     SrceStr: String;
  1045.     S      : Integer;
  1046. begin
  1047.   S:= 0;
  1048.  
  1049.   Repeat
  1050.     SrceStr:= SourceStrings[S];
  1051.     SStr:= Uppercase(SrceStr);
  1052.     Strip(SStr);
  1053.     Inc(S);
  1054.   Until (Pos('PUBLIC',SStr) > 0) or (S >= SourceStrings.Count);
  1055.   Repeat
  1056.     SrceStr:= SourceStrings[S];
  1057.     SStr:= Uppercase(SrceStr);
  1058.     Strip(SStr);
  1059.     if (Pos(UpperCase(RECORDNAME+'DATEN'),SStr) > 0) or
  1060.        (Pos(UpperCase(RECORDNAME+'DUP'),SStr) > 0)
  1061.     then
  1062.     begin
  1063.       SourceStrings.Delete(S);
  1064.       if Sprache = 1 then SErrorwindow(RECORDNAME+' deleted','')
  1065.       else Serrorwindow(RECORDNAME+' wird gel÷scht','DAT: und DUP:');
  1066.     end
  1067.     else
  1068.     Inc(S);
  1069.   Until (Pos('PROCEDURE',SStr) > 0) or
  1070.         (Pos('PROPERTY',SStr) > 0) or
  1071.         (Pos('FUNCTION',SStr) > 0) or
  1072.         (Pos('END;',SStr) > 0) or
  1073.         (S >= SourceStrings.Count);
  1074.   Dec(S);
  1075.   SStr:= '    '+RecordName+'Daten: '+FRecordName+';';
  1076.   SourceStrings.Insert(S,SStr);
  1077.   SStr:= '    '+RecordName+'Dup : '+FRecordName+';';
  1078.   SourceStrings.Insert(S,SStr);
  1079. end;
  1080.  
  1081.  
  1082. Procedure TIsamTable.Key_Deklaration_Einfuegen(var SourceStrings: TStringList);
  1083. {ok}
  1084. var KStr,KeyStr,
  1085.     SStr,SrceStr: String;
  1086.     KeyStrings  : TStringList;
  1087.     R,S         : Integer;
  1088. begin
  1089.   if FIsamKey = Nil then exit;
  1090.   {Nach Public und darauf folgendem End suchen}
  1091.   S := 0;
  1092.   Repeat
  1093.     SrceStr:= SourceStrings[S];
  1094.     SStr:= Uppercase(SrceStr);
  1095.     Strip(SStr);
  1096.     Inc(S);
  1097.   Until (Pos('PUBLIC',SStr) > 0) or (S >= SourceStrings.Count);
  1098.   Repeat
  1099.     SrceStr:= SourceStrings[S];
  1100.     SStr:= Uppercase(SrceStr);
  1101.     Strip(SStr);
  1102.     Inc(S);
  1103.   Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1104.   Dec(S);
  1105.  
  1106.   {Wenn die Keyproc besteht, dann l÷schen}
  1107.   Repeat
  1108.     SrceStr:= SourceStrings[S];
  1109.     SStr:= Uppercase(SrceStr);
  1110.     Strip(SStr);
  1111.     if (Pos(UpperCase(RecordName)+'KEYPROC(',SStr) > 0) then
  1112.     begin
  1113.       SourceStrings.Delete(S);
  1114.       if Sprache = 1 then SErrorwindow('Delete KEYPROC-Declaration','')
  1115.       else SErrorwindow('KeyprocDeklaration wird gel÷scht','');
  1116.     end else Inc(S);
  1117.   Until (Pos('IMPLEMENTATION',SStr) > 0) or (S >= SourceStrings.Count);
  1118.  
  1119.   {Nun wieder von vorne und die KeyProc eintragen}
  1120.   S := 0;
  1121.   Repeat
  1122.     SrceStr:= SourceStrings[S];
  1123.     SStr:= Uppercase(SrceStr);
  1124.     Strip(SStr);
  1125.     Inc(S);
  1126.   Until (Pos('PUBLIC',SStr) > 0) or (S >= SourceStrings.Count);
  1127.   Repeat
  1128.     SrceStr:= SourceStrings[S];
  1129.     SStr:= Uppercase(SrceStr);
  1130.     Strip(SStr);
  1131.     Inc(S);
  1132.   Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1133.   SourceStrings.Insert(S,'Function '+RecordName+'KeyProc(Var Daten; KeyNr:Word): IsamKeyStr; FAR;');
  1134.   inc(S);
  1135.   if Sprache = 1 then SErrorwindow('KEYPROC-declaration added','')
  1136.   else SErrorwindow('KeyprocDeklaration wird hinzugefⁿgt','');
  1137. end;
  1138.  
  1139. Procedure TIsamTable.GetFeldProc_Einfuegen(var SourceStrings : TStringList);
  1140. var KStr,KeyStr,
  1141.     SStr,SrceStr: String;
  1142.     KeyStrings  : TStringList;
  1143.     R,S         : Integer;
  1144.     Gefunden    : Boolean;
  1145. begin
  1146.   R := 0;
  1147.   if IsamRecord.Count < 1 then begin
  1148.     if Sprache = 1 then Errorwindow('no record defined','')
  1149.     else Errorwindow('Kein Record definiert','');
  1150.     Exit;
  1151.   end;
  1152.   S := 0;
  1153.   {zuerst wird bis nach Implementation gesucht (*.DFM)}
  1154.   Repeat
  1155.     SrceStr:= SourceStrings[S];
  1156.     SStr:= Uppercase(SrceStr);
  1157.     Strip(SStr);
  1158.     Inc(S);
  1159.   Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1160.   Dec(S);
  1161.  
  1162.   Repeat
  1163.     SrceStr:= SourceStrings[S];
  1164.     SStr:= Uppercase(SrceStr);
  1165.     Strip(SStr);
  1166.     Inc(S);
  1167.   Until (Pos(UpperCase(RecordName)+'GETFELDPROC(',SStr) > 0) or (S >= SourceStrings.Count);
  1168.   if (Pos(UpperCase(RecordName)+'GETFELDPROC(',SStr) > 0) then
  1169.   begin
  1170.     if Sprache = 1 then SErrorwindow('GetFeldProc will be deleted','')
  1171.     else SErrorwindow('GetFeldProc wird gel÷scht.','');
  1172.     Dec(S);
  1173.     Repeat
  1174.       SourceStrings.Delete(S);
  1175.       SrceStr:= SourceStrings[S];
  1176.       SStr:= Uppercase(SrceStr);
  1177.       Strip(SStr);
  1178.     Until (Pos('RESULT',SStr) > 0)
  1179.           or(S >= SourceStrings.Count);
  1180.     SourceStrings.Delete(S);
  1181.     SourceStrings.Delete(S); {Das ist das end; der GetFeldProc}
  1182.   end else
  1183.   begin
  1184.     {wenn GetFeldProc nicht gefunden}
  1185.     S := 0;
  1186.     Repeat
  1187.       SrceStr:= SourceStrings[S];
  1188.       SStr:= Uppercase(SrceStr);
  1189.       Strip(SStr);
  1190.       inc(S);
  1191.     Until (S >= SourceStrings.Count)
  1192.           or (Pos(Uppercase('{$R*.DFM'),SStr) > 0);
  1193.     Dec(s);
  1194.     SourceStrings.Insert(S,' ');
  1195.     Inc(S);
  1196.   end;
  1197.   R:= 0;
  1198.   if Sprache = 1 then SErrorwindow('GetFeldProc added','')
  1199.   else SErrorwindow('GetFeldProc wird eingetragen.','');
  1200.   SourceStrings.Insert(S,'Function '+RecordName+'GetFeldProc(Feld: Integer; Table: TIsamTable; var DATA): String; far;');
  1201.   Inc(S);
  1202.   SourceStrings.Insert(S,'var S: String;');
  1203.   Inc(S);
  1204.   SourceStrings.Insert(S,'begin');
  1205.   Inc(S);
  1206.   SourceStrings.Insert(S,'  S:= '+Chr(39)+Chr(39)+';');
  1207.   Inc(S);
  1208.   SourceStrings.Insert(S,'  With '+RECORDName+'(Data) do begin');
  1209.   Inc(S);
  1210.   SourceStrings.Insert(S,'    Case Feld of');
  1211.   Inc(S);
  1212.   BrowRow(SourceStrings,S);
  1213.   SourceStrings.Insert(S,'    end;');
  1214.   Inc(S);
  1215.   SourceStrings.Insert(S,'  end;');
  1216.   Inc(S);
  1217.   SourceStrings.Insert(S,'  Result:= S;');
  1218.   Inc(S);
  1219.   SourceStrings.Insert(S,'end;');
  1220.   Inc(S);
  1221. end;
  1222.  
  1223. Procedure TIsamTable.Key_Proc_Einfuegen(var SourceStrings : TStringList);
  1224. {ok noch nicht ganz}
  1225. var KStr,KeyStr,
  1226.     SStr,SrceStr: String;
  1227.     KeyStrings  : TStringList;
  1228.     R,S         : Integer;
  1229.     Gefunden    : Boolean;
  1230. begin
  1231.   R := 0;
  1232.   S := 0;
  1233.   if FIsamKey = Nil then exit;
  1234.   KeyStrings := TStringList.Create;
  1235.   KeyStrings.Assign(FIsamKey);
  1236.   if KeyStrings.Count = 0 then exit;
  1237.  
  1238.   {zuerst wird bis nach Implementation gesucht (*.DFM)}
  1239.  
  1240.   Repeat
  1241.     SrceStr:= SourceStrings[S];
  1242.     SStr:= Uppercase(SrceStr);
  1243.     Strip(SStr);
  1244.     Inc(S);
  1245.   Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1246.   Dec(S);
  1247.  
  1248.   Repeat
  1249.     SrceStr:= SourceStrings[S];
  1250.     SStr:= Uppercase(SrceStr);
  1251.     Strip(SStr);
  1252.     Inc(S);
  1253.   Until (Pos(UpperCase(RecordName)+'KEYPROC(',SStr) > 0) or (S >= SourceStrings.Count);
  1254.   if (Pos(UpperCase(RecordName)+'KEYPROC(',SStr) > 0) then
  1255.   begin
  1256.     if Sprache = 1 then SErrorwindow('KeyProc will be deleted','')
  1257.     else SErrorwindow('KeyProc wird gel÷scht.','');
  1258.     Dec(S);
  1259.     Repeat
  1260.       SourceStrings.Delete(S);
  1261.       SrceStr:= SourceStrings[S];
  1262.       SStr:= Uppercase(SrceStr);
  1263.       Strip(SStr);
  1264.     Until (Pos(Uppercase(RecordName+'KEYPROC'),SStr) > 0)
  1265.           or(S >= SourceStrings.Count);
  1266.     SourceStrings.Delete(S);
  1267.     SourceStrings.Delete(S); {Das ist das end; der Keyproc}
  1268.   end else
  1269.   begin
  1270.     {wenn KeyProc nicht gefunden}
  1271.     S := 0;
  1272.     Repeat
  1273.       SrceStr:= SourceStrings[S];
  1274.       SStr:= Uppercase(SrceStr);
  1275.       Strip(SStr);
  1276.       inc(S);
  1277.     Until (S >= SourceStrings.Count)
  1278.           or (Pos(Uppercase('END.'),SStr) > 0);
  1279.     Dec(s);
  1280.     Dec(s);
  1281.   end;
  1282.   R:= 0;
  1283.   if Sprache = 1 then SErrorwindow('KeyProc will be added','')
  1284.   else SErrorwindow('KeyProc wird eingetragen.','');
  1285.   Repeat
  1286.     KeyStr:= KeyStrings[R];
  1287.     KStr:= Uppercase(KeyStr);
  1288.     if Pos('FUNCTION ',KStr) > 0 then begin
  1289.       SStr:= KStr;
  1290.       System.Delete(SStr,Pos('FUNCTION ',SStr),9);
  1291.       if Pos('KEYPROC',SStr) > 0 then System.Delete(SStr,1,Pos('KEYPROC',SStr)-1);
  1292.       KeyStr:= 'Function '+RecordName+SStr;
  1293.     end;
  1294.     if Pos('(DATEN)',KStr) > 0 then begin
  1295.       SStr:= KStr;
  1296.       System.Delete(SStr,1,Pos('(DATEN)',SStr)-1);
  1297.       KeyStr:= '  With '+FRecordName+'(Daten) do begin';
  1298.     end;
  1299.     if Pos('KEYPROC:=',KStr) > 0 then begin
  1300.       SStr:= KStr;
  1301.       System.Delete(SStr,1,Pos('KEYPROC:=',SStr)-1);
  1302.       KeyStr:= '  '+RecordName+SStr;
  1303.     end;
  1304.     SourceStrings.Insert(S,KeyStr);
  1305.     Inc(S);
  1306.     Inc(R);
  1307.   Until R >= KeyStrings.Count;
  1308. end;
  1309.  
  1310. Procedure TIsamTable.FormCreate_Einfuegen(var SourceStrings: TStringList);
  1311. {ok}
  1312. var SrceStr,SStr: String;
  1313.     Gefunden1,
  1314.     Gefunden2,
  1315.     Gefunden3    : Boolean;
  1316.     i           : Byte;
  1317.     S           : Integer;
  1318.     FormName    : String;
  1319. begin
  1320.   Gefunden1 := Check('Procedure FormCreate(Sender',SourceStrings) ;
  1321.   Gefunden2 := Check('Procedure FormResize(Sender',SourceStrings) ;
  1322.   Gefunden3 := Check('Procedure FormShow(Sender',SourceStrings) ;
  1323.   FormName:= GetFormName(SourceStrings);
  1324.   S:= 0;
  1325.   Gefunden1 := False;
  1326.   Repeat
  1327.     SrceStr:= SourceStrings[S];
  1328.     SStr:= Uppercase(SrceStr);
  1329.     Strip(SStr);
  1330.     if Pos('FORMCREATE',SStr) > 0 then Gefunden1:= True;
  1331.     Inc(S);
  1332.   Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1333.   if S < SourceStrings.Count then begin
  1334.     if Gefunden1 = False then begin
  1335.       Dec(S);
  1336.       SourceStrings.Insert(S,'    Procedure FormCreate(Sender: TObject);');
  1337.       Inc(S);
  1338.     end;
  1339.     If Gefunden2 = False then begin
  1340.       if BrowserName <> '' then begin
  1341.         SourceStrings.Insert(S,'    Procedure FormResize(Sender: TObject);');
  1342.         Inc(S);
  1343.       end;
  1344.     end;
  1345.     if Gefunden3 = False then begin
  1346.       if BrowserName <> '' then begin
  1347.         SourceStrings.Insert(S,'    Procedure FormShow(Sender: TObject);');
  1348.         Inc(S);
  1349.       end;
  1350.     end;
  1351.     Repeat
  1352.       SrceStr:= SourceStrings[S];
  1353.       SStr:= Uppercase(SrceStr);
  1354.       Strip(SStr);
  1355.       Inc(S);
  1356.     Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1357.   end;
  1358.   if S < SourceStrings.Count then begin
  1359.     Repeat
  1360.       SrceStr:= SourceStrings[S];
  1361.       SStr:= Uppercase(SrceStr);
  1362.       Strip(SStr);
  1363.       Inc(S);
  1364.     Until (Pos('FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1365.   end;
  1366.   {Nun wird Formcreate eingetragen}
  1367.   if Pos('FORMCREATE',SStr) = 0 then
  1368.   begin
  1369.     Dec(S);
  1370.     SourceStrings.Insert(S,'Procedure '+FormName+'.FormCreate(Sender: TObject);');
  1371.     Inc(S);
  1372.     SourceStrings.Insert(S,'begin');
  1373.     Inc(S);
  1374.     SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1375.     Inc(S);
  1376.     SourceStrings.Insert(S,'end;');
  1377.     Inc(S);
  1378.     SourceStrings.Insert(S,'');
  1379.     Inc(S);
  1380.     if Gefunden2 = False then begin
  1381.       if BrowserName <> '' then begin
  1382.         SourceStrings.Insert(S,'Procedure '+FormName+'.FormResize(Sender: TObject);');
  1383.         inc(S);
  1384.         SourceStrings.Insert(S,'begin');
  1385.         Inc(S);
  1386.         SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1387.         Inc(S);
  1388.         SourceStrings.Insert(S,'end;');
  1389.         Inc(S);
  1390.         SourceStrings.Insert(S,'');
  1391.         Inc(S);
  1392.       end;
  1393.     end;
  1394.     If gefunden3 = False then begin
  1395.       if BrowserName <> '' then begin
  1396.         SourceStrings.Insert(S,'Procedure '+FormName+'.FormShow(Sender: TObject);');
  1397.         inc(S);
  1398.         SourceStrings.Insert(S,'begin');
  1399.         Inc(S);
  1400.         SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1401.         Inc(S);
  1402.         SourceStrings.Insert(S,'end;');
  1403.         Inc(S);
  1404.         SourceStrings.Insert(S,'');
  1405.         Inc(S);
  1406.       end;
  1407.     end;
  1408.     if Sprache = 1 then SErrorwindow('Procedures Formcreate, FormShow, FormResize','added')
  1409.     else SErrorwindow('Proceduren Formcreate,FormShow,FormResize ','werden eingetragen.');
  1410.   end;
  1411. end;
  1412.  
  1413.  
  1414. Procedure TIsamTable.Formcreate_Fuellen(var SourceStrings: TStringList);
  1415. {ok}
  1416. Var
  1417.    S,R           : Integer;
  1418.    SrceStr, SStr,
  1419.    FormName      : String;
  1420.    IIDStr        : String;
  1421.    IIDStrings    : TStringList;
  1422.    Gefunden1,
  1423.    Gefunden2,
  1424.    Gefunden3,
  1425.    Gefunden4: Boolean;
  1426. begin
  1427.   Gefunden1 := Check('with '+UpperCase(NAME)+' do begin',SourceStrings);
  1428.   Gefunden2 := Check(BrowserName+'.OnBuildRow:=',SourceStrings);
  1429.   Gefunden3 := Check(BrowserName+'.BrowserHeader:=',SourceStrings);
  1430.   Gefunden4 := Check(HeaderName+'.OnSized:= '+HeaderName+'Sized;',SourceStrings);
  1431.   FormName:= GetFormName(SourceStrings);
  1432.   S := 0;
  1433.   {Formcreate-Rumpf wird gesucht}
  1434.   Repeat
  1435.    SrceStr:= SourceStrings[S];
  1436.    SStr:= Uppercase(SrceStr);
  1437.    Strip(SStr);
  1438.    Inc(S);
  1439.   Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1440.  
  1441.   {Formcreate Begin wird gesucht}
  1442.   Dec(S);
  1443.   Repeat
  1444.     SrceStr:= SourceStrings[S];
  1445.     SStr:= Uppercase(SrceStr);
  1446.     Strip(SStr);
  1447.     Inc(S);
  1448.   Until (Pos('BEGIN',SStr) > 0) or (S >= SourceStrings.Count);
  1449.  
  1450.   if not Gefunden1 then
  1451.   begin
  1452.     if Sprache = 1 then SErrorwindow('KeyProc will be added to FORMCREATE','')
  1453.     else SErrorwindow('KeyProc wird in','Formcreate eingetragen');
  1454.     SourceStrings.Insert(S,'  with '+Name+' do begin');
  1455.     Inc(S);
  1456.     SourceStrings.Insert(S,'    Key_Proc :=  '+Recordname+'KEYPROC;');
  1457.     Inc(S);
  1458.     SourceStrings.Insert(S,'    Recsize:= Sizeof('+FRecordName+');');
  1459.     Inc(S);
  1460.     if FIID.Count > 0 then begin
  1461.       R := 0;
  1462.       Repeat
  1463.         IIDStr := FIID[R];
  1464.         inc(R);
  1465.         SourceStrings.Insert(S,'  '+IIDStr);
  1466.         Inc(S);
  1467.       Until R >=  FIID.Count;
  1468.     end;
  1469.     SourceStrings.Insert(S,'    Active:= True;');
  1470.     Inc(S);
  1471.     SourceStrings.Insert(S,'  end;');
  1472.     Inc(S);
  1473.   end;
  1474.   if not Gefunden2 then begin
  1475.     if BrowserName <> '' then begin
  1476.       if Sprache = 1 then SErrorwindow('OnBuildRow and ConnectLowBrowser',
  1477.                    'will be added to FORMCREATE')
  1478.       else SErrorwindow('OnbuildRow und ConnectLowBrowser',
  1479.                    'wird in Formcreate eingetragen');
  1480.       S := 0;
  1481.      {Formcreate-Rumpf wird gesucht}
  1482.       Repeat
  1483.         SrceStr:= SourceStrings[S];
  1484.         SStr:= Uppercase(SrceStr);
  1485.         Strip(SStr);
  1486.         Inc(S);
  1487.       Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1488.       Repeat
  1489.         SrceStr:= SourceStrings[S];
  1490.         SStr:= Uppercase(SrceStr);
  1491.         Strip(SStr);
  1492.         Inc(S);
  1493.       Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1494.       Dec(S);
  1495.       SourceStrings.Insert(S,'  if '+Name+'.Active then begin');
  1496.       Inc(S);
  1497.       SourceStrings.Insert(S,'    '+BrowserName+'.OnBuildRow:= '+BrowserName+'BuildRow;');
  1498.       Inc(S);
  1499.       SourceStrings.Insert(S,'    '+BrowserName+'.ConnectLowBrowser(New(PLowWinBrowser, Init(True, '+Name+'.IFBPTR,');
  1500.       Inc(S);
  1501.       SourceStrings.Insert(S,'         1, 50, 1, '+Chr(39)+Chr(39)+', '+Chr(39)+Chr(39)+', '+RecordName+'Daten, False )));');
  1502.       Inc(S);
  1503.       SourceStrings.Insert(S,'    '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1504.       Inc(S);
  1505.       SourceStrings.Insert(S,'  end;');
  1506.       Inc(S);
  1507.     end;
  1508.   end;
  1509.   if not Gefunden3  then begin
  1510.     if (BrowserName <> '') and (HeaderName <> '') then begin
  1511.       if Sprache = 1 then SErrorwindow('BrowserHeader will be added to FORMCREATE','')
  1512.       else SErrorwindow('BrowserHeader','wird in Formcreate eingetragen');
  1513.       S := 0;
  1514.      {Formcreate-Rumpf wird gesucht}
  1515.       Repeat
  1516.         SrceStr:= SourceStrings[S];
  1517.         SStr:= Uppercase(SrceStr);
  1518.         Strip(SStr);
  1519.         Inc(S);
  1520.       Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1521.       Repeat
  1522.         SrceStr:= SourceStrings[S];
  1523.         SStr:= Uppercase(SrceStr);
  1524.         Strip(SStr);
  1525.         Inc(S);
  1526.       Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1527.       Dec(S);
  1528.       SourceStrings.Insert(S,'  '+BrowserName+'.BrowserHeader:= '+HeaderName+';');
  1529.       Inc(S);
  1530.     end;
  1531.   end;
  1532.   if not Gefunden4 then begin
  1533.     if HeaderName <> '' then begin
  1534.       S := 0;
  1535.      {Formcreate-Rumpf wird gesucht}
  1536.       Repeat
  1537.         SrceStr:= SourceStrings[S];
  1538.         SStr:= Uppercase(SrceStr);
  1539.         Strip(SStr);
  1540.         Inc(S);
  1541.       Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1542.       Repeat
  1543.         SrceStr:= SourceStrings[S];
  1544.         SStr:= Uppercase(SrceStr);
  1545.         Strip(SStr);
  1546.         Inc(S);
  1547.       Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1548.       Dec(S);
  1549.       SourceStrings.Insert(S,'  '+HeaderName+'.OnSized:= '+HeaderName+'Sized;');
  1550.       Inc(S);
  1551.     end;
  1552.   end;
  1553. end;
  1554.  
  1555. Procedure TIsamTable.FormResize_Fuellen(var SourceStrings: TStringList);
  1556. Var
  1557.    S             : Integer;
  1558.    SrceStr, SStr,
  1559.    FormName      : String;
  1560.    Gefunden1,Gefunden2      : Boolean;
  1561. begin
  1562.   FormName:= GetFormName(SourceStrings);
  1563.   S := 0;
  1564.   Gefunden1:= Check(FormName+'.FormResize(',SourceStrings);
  1565.   Gefunden2 := Check(BrowserName+'.Height',SourceStrings);
  1566.   if Gefunden1 = False then begin
  1567.     Repeat
  1568.       SrceStr:= SourceStrings[S];
  1569.       SStr:= Uppercase(SrceStr);
  1570.       Strip(SStr);
  1571.       Inc(S);
  1572.     Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1573.     Dec(S);
  1574.     if BrowserName <> '' then begin
  1575.       SourceStrings.Insert(S,'Procedure '+FormName+'.FormResize(Sender: TObject);');
  1576.       inc(S);
  1577.       SourceStrings.Insert(S,'begin');
  1578.       Inc(S);
  1579.       SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1580.       Inc(S);
  1581.       SourceStrings.Insert(S,'end;');
  1582.       Inc(S);
  1583.       SourceStrings.Insert(S,'');
  1584.       Inc(S);
  1585.     end;
  1586.     S:= 0;
  1587.   end;
  1588.   {FormResize-Rumpf wird gesucht}
  1589.   Repeat
  1590.    SrceStr:= SourceStrings[S];
  1591.    SStr:= Uppercase(SrceStr);
  1592.    Strip(SStr);
  1593.    Inc(S);
  1594.   Until (Pos(UpperCase(FormName+'.FORMRESIZE'),SStr) > 0) or (S >= SourceStrings.Count);
  1595.  
  1596.   {FormResize Begin wird gesucht}
  1597.   Dec(S);
  1598.   Repeat
  1599.     SrceStr:= SourceStrings[S];
  1600.     SStr:= Uppercase(SrceStr);
  1601.     Strip(SStr);
  1602.     Inc(S);
  1603.   Until (Pos('BEGIN',SStr) > 0) or (S >= SourceStrings.Count);
  1604.  
  1605.   if not Gefunden2 then begin
  1606.     if BrowserName <> '' then begin
  1607.       if Sprache = 1 then SErrorwindow('Browser.Height and Browser.Width added to FORMRESIZE')
  1608.       else SErrorwindow('Browser.Height und Browser.With wird in','FormResize eingetragen');
  1609.       SourceStrings.Insert(S,'  '+BrowserName+'.Height := ClientHeight-Header1.Height - 10;');
  1610.       inc(S);
  1611.       SourceStrings.Insert(S,'  '+BrowserName+'.Width := ClientWidth - 2;');
  1612.       inc(S);
  1613.     end;
  1614.   end;
  1615. end;
  1616.  
  1617.  
  1618. Procedure TIsamTable.FormShow_Fuellen(var SourceStrings: TStringList);
  1619. {ok}
  1620. Var
  1621.    S             : Integer;
  1622.    SrceStr, SStr,
  1623.    FormName      : String;
  1624.    Gefunden1,Gefunden2: Boolean;
  1625. begin
  1626.   S := 0;
  1627.   FormName:= GetFormName(SourceStrings);
  1628.   Gefunden1 := Check(FormName+'.FormShow(',SourceStrings);
  1629.   Gefunden2 := Check(BrowserName+'.KeyNumber := 1',SourceStrings);
  1630.   if Gefunden1 = False then begin
  1631.     Repeat
  1632.       SrceStr:= SourceStrings[S];
  1633.       SStr:= Uppercase(SrceStr);
  1634.       Strip(SStr);
  1635.       Inc(S);
  1636.     Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1637.     Dec(S);
  1638.     if BrowserName <> '' then begin
  1639.       SourceStrings.Insert(S,'Procedure '+FormName+'.FormShow(Sender: TObject);');
  1640.       inc(S);
  1641.       SourceStrings.Insert(S,'begin');
  1642.       Inc(S);
  1643.       SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1644.       Inc(S);
  1645.       SourceStrings.Insert(S,'end;');
  1646.       Inc(S);
  1647.       SourceStrings.Insert(S,'');
  1648.       Inc(S);
  1649.     end;
  1650.     S:= 0;
  1651.   end;
  1652.   {FormShow-Rumpf wird gesucht}
  1653.   Repeat
  1654.    SrceStr:= SourceStrings[S];
  1655.    SStr:= Uppercase(SrceStr);
  1656.    Strip(SStr);
  1657.    Inc(S);
  1658.   Until (Pos(UpperCase(FormName+'.FORMSHOW'),SStr) > 0) or (S >= SourceStrings.Count);
  1659.   {FormShow Begin wird gesucht}
  1660.   Dec(S);
  1661.   Repeat
  1662.     SrceStr:= SourceStrings[S];
  1663.     SStr:= Uppercase(SrceStr);
  1664.     Strip(SStr);
  1665.     Inc(S);
  1666.   Until (Pos('BEGIN',SStr) > 0) or (S >= SourceStrings.Count);
  1667.  
  1668.   if not Gefunden2 then begin
  1669.     if BrowserName <> '' then begin
  1670.       SourceStrings.Insert(S,'  '+Name+'.KeyNo:= '+BrowserName+'.ReadIni;');
  1671.       inc(S);
  1672.       if Sprache = 1 then SErrorwindow('Browser.KeyNumber and Section added to FORMSHOW','')
  1673.       else SErrorwindow('Browser.KeyNumber und Section wird in','FormShow eingetragen');
  1674.       SourceStrings.Insert(S,'  '+BrowserName+'.ClearIncss;');
  1675.       inc(S);
  1676.       SourceStrings.Insert(S,'  '+BrowserName+'.KeyNumber := 1;');
  1677.       inc(S);
  1678.       SourceStrings.Insert(S,'  '+BrowserName+'.KeySection := 0;');
  1679.       inc(S);
  1680.       SourceStrings.Insert(S,'  '+BrowserName+'.AllowIncSS := True;');
  1681.       inc(S);
  1682.       SourceStrings.Insert(S,'  '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1683.       inc(S);
  1684.     end;
  1685.   end;
  1686. end;
  1687.  
  1688.  
  1689. Procedure TIsamTable.HeaderCreate_Einfuegen(var SourceStrings: TStringList);
  1690. {ok}
  1691. var SrceStr,SStr: String;
  1692.     Gefunden    : Boolean;
  1693.     i           : Byte;
  1694.     S           : Integer;
  1695.     FormName    : String;
  1696.  
  1697. begin
  1698.   if (HeaderName <> '') and (BrowserName <> '') then begin
  1699.     if Check('Procedure '+HeaderName+'Sized(Sender',SourceStrings) then
  1700.     begin
  1701.       if Sprache = 1 then SErrorwindow('Procedure Header.Sized already exists','')
  1702.       else SErrorwindow('Procedure Header.Sized()','existiert bereits.');
  1703.       exit;
  1704.     end;
  1705.     FormName:= GetFormName(SourceStrings);
  1706.     S:= 0;
  1707.     Gefunden:= False;
  1708.     Repeat
  1709.       SrceStr:= SourceStrings[S];
  1710.       SStr:= Uppercase(SrceStr);
  1711.       Strip(SStr);
  1712.       if Pos(UpperCase('Procedure'+HeaderName+'Sized'),SStr) > 0 then Gefunden:= True;
  1713.       Inc(S);
  1714.     Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1715.     if Gefunden = False then
  1716.     begin
  1717.       Dec(S);
  1718.       SourceStrings.Insert(S,'    Procedure '+HeaderName+'Sized(Sender: TObject; ASection, AWidth: Integer);');
  1719.       Inc(S);
  1720.       if Sprache = 1 then SErrorwindow('Procedure Header.Sized added','')
  1721.       else SErrorwindow('Procedure Header.Sized()','wird eingetragen.');
  1722.     end;
  1723.     Repeat
  1724.       SrceStr:= SourceStrings[S];
  1725.       SStr:= Uppercase(SrceStr);
  1726.       Strip(SStr);
  1727.       Inc(S);
  1728.     Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1729.  
  1730.     Repeat
  1731.       SrceStr:= SourceStrings[S];
  1732.       SStr:= Uppercase(SrceStr);
  1733.       Strip(SStr);
  1734.       Inc(S);
  1735.     Until (Pos(UpperCase('Procedure'+FormName+'.'+HeaderName+'Sized(Sender'),SStr) > 0)
  1736.           or (S >= SourceStrings.Count);
  1737.     if Pos(UpperCase('Procedure'+FormName+'.'+HeaderName+'Sized(Sender'),SStr) = 0 then
  1738.     begin
  1739.       S:= 0;
  1740.       Repeat
  1741.         SrceStr:= SourceStrings[S];
  1742.         SStr:= Uppercase(SrceStr);
  1743.         Strip(SStr);
  1744.         Inc(S);
  1745.       Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1746.       Dec(S);
  1747.       SourceStrings.Insert(S,'Procedure '+FormName+'.'+HeaderName+
  1748.                              'Sized(Sender: TObject;  ASection, AWidth: Integer);');
  1749.       Inc(S);
  1750.       SourceStrings.Insert(S,'begin');
  1751.       inc(S);
  1752.       SourceStrings.Insert(S,'  {'+BrowserName+'.ResizeHeader;}');
  1753.       inc(S);
  1754.       SourceStrings.Insert(S,'  '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1755.       inc(S);
  1756.       SourceStrings.Insert(S,'end;');
  1757.       inc(S);
  1758.       SourceStrings.Insert(S,'');
  1759.       inc(S);
  1760.       if Sprache = 1 then then sErrorwindow('Procedure Header.Sized added','')
  1761.       else SErrorwindow('Procedure Header.Sized() ','wird eingetragen.');
  1762.     end;
  1763.   end;
  1764. end;
  1765.  
  1766. Procedure TIsamTable.Browser_BuildRow_Einfuegen(var SourceStrings: TStringList);
  1767. {ok}
  1768. var SrceStr,SStr: String;
  1769.     Gefunden    : Boolean;
  1770.     i           : Byte;
  1771.     S           : Integer;
  1772.     FormName    : String;
  1773.  
  1774. begin
  1775.   if BrowserName <> '' then begin
  1776.     if Check('Function '+BrowserName+'BuildRow(',SourceStrings) then
  1777.     begin
  1778.       if Sprache = 1 then then SErrorwindow(BrowserName+'Buildrow already exists','')
  1779.       else SErrorwindow(BrowserName+'BuildRow()','existiert bereits.');
  1780.       Exit;
  1781.     end;
  1782.     FormName:= GetFormName(SourceStrings);
  1783.     S:= 0;
  1784.     Gefunden:= False;
  1785.     Repeat
  1786.       SrceStr:= SourceStrings[S];
  1787.       SStr:= Uppercase(SrceStr);
  1788.       Strip(SStr);
  1789.       if Pos(UpperCase('Function'+FormName+'.'+
  1790.          BrowserName+'BuildRow('),SStr) > 0 then Gefunden:= True;
  1791.       Inc(S);
  1792.     Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1793.     if Gefunden = False then
  1794.     begin
  1795.       Dec(S);
  1796.       SourceStrings.Insert(S,'    Function '+BrowserName+'BuildRow(Sender: TObject; var RR: RowRec): Integer;');
  1797.       Inc(S);
  1798.       if Sprache = 1 then then SErrorwindow('Function Buildrow will be added','')
  1799.       else SErrorwindow('Function BuildRow','wird eingetragen.');
  1800.     end;
  1801.     Repeat
  1802.       SrceStr:= SourceStrings[S];
  1803.       SStr:= Uppercase(SrceStr);
  1804.       Strip(SStr);
  1805.       Inc(S);
  1806.     Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1807.     Repeat
  1808.       SrceStr:= SourceStrings[S];
  1809.       SStr:= Uppercase(SrceStr);
  1810.       Strip(SStr);
  1811.       Inc(S);
  1812.     Until (Pos(UpperCase('FUNCTION'+UpperCase(FormName)+'.'+UpperCase(BrowserName)+'BUILDROW'),SStr) > 0)
  1813.            or (S >= SourceStrings.Count);
  1814.     if Pos(UpperCase('FUNCTION'+UpperCase(FormName)+'.'+
  1815.        UpperCase(BrowserName)+'BUILDROW'),SStr) = 0 then
  1816.     begin
  1817.       S:= 0;
  1818.       Repeat
  1819.         SrceStr:= SourceStrings[S];
  1820.         SStr:= Uppercase(SrceStr);
  1821.         Strip(SStr);
  1822.         Inc(S);
  1823.       Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1824.       Dec(S);
  1825.       SourceStrings.Insert(S,'Function '+FormName+'.'+BrowserName+'BuildRow(Sender: TObject; var RR: RowRec): Integer;');
  1826.       Inc(S);
  1827.       SourceStrings.Insert(S,'begin');
  1828.       inc(S);
  1829.       SourceStrings.Insert(S,'  Result := NoError;');
  1830.       inc(S);
  1831.       SourceStrings.Insert(S,'  Satzlesen('+Name+'.IfbPtr,RR.Ref,'+RecordName
  1832.                                  +'Daten,'+RecordName+'Dup);');
  1833.       inc(s);
  1834.       SourceStrings.Insert(S,'  with '+RecordName+'Daten do begin');
  1835.       inc(S);
  1836.       SourceStrings.Insert(S,'    if RR.Status <> NoError then begin');
  1837.       inc(S);
  1838.       SourceStrings.Insert(S,'      RR.Row := F('+Chr(39)+'****  '+Chr(39)+' + RR.IKS, MaxCols);');
  1839.       inc(S);
  1840.       SourceStrings.Insert(S,'    end else begin');
  1841.       inc(S);
  1842.       SourceStrings.Insert(S,'      RR.Row:= '+BrowserName+
  1843.                '.GetRow('+RECORDName+'GetFeldProc,'+RecordName+'Data);');
  1844.       inc(S);
  1845.       SourceStrings.Insert(S,'    end;');
  1846.       inc(S);
  1847.       SourceStrings.Insert(S,'  end;');
  1848.       inc(S);
  1849.       SourceStrings.Insert(S,'end;');
  1850.       inc(S);
  1851.       if Sprache = 1 then then SErrorwindow('Function Buildrow added','')
  1852.       else SErrorwindow('Function BuildRow ','wird eingetragen.');
  1853.     end;
  1854.   end;
  1855. end;
  1856.  
  1857. Procedure TIsamTable.Browser_Edit_Einfuegen(var SourceStrings: TStringList);
  1858. var SrceStr,SStr: String;
  1859.     Gef1,Gef2   : Boolean;
  1860.     i           : Byte;
  1861.     S           : Integer;
  1862.     FormName    : String;
  1863. begin
  1864.   if BrowserName <> '' then begin
  1865.     Gef1:= Check('Procedure '+BrowserName+'DblClick(',SourceStrings);
  1866.     Gef2:= Check('Procedure '+FormName+'.'+BrowserName+'DblClick(',SourceStrings);
  1867.     FormName:= GetFormName(SourceStrings);
  1868.     if Gef1 = False then begin
  1869.       S:= 0;
  1870.       Repeat
  1871.         SrceStr:= SourceStrings[S];
  1872.         SStr:= Uppercase(SrceStr);
  1873.         Strip(SStr);
  1874.         Inc(S);
  1875.       Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1876.       Dec(S);
  1877.       SourceStrings.Insert(S,'    Procedure '+BrowserName+'DblClick(Sender: TObject);');
  1878.       Inc(S);
  1879.     end;
  1880.     if Gef2 = False then begin
  1881.       S:= 0;
  1882.       Repeat
  1883.         SrceStr:= SourceStrings[S];
  1884.         SStr:= Uppercase(SrceStr);
  1885.         Strip(SStr);
  1886.         Inc(S);
  1887.       Until (Pos('END.',SStr) > 0) or (S >= SourceStrings.Count);
  1888.       Dec(S);
  1889.       SourceStrings.Insert(S,'procedure '+FormName+'.'+BrowserName+'DblClick(Sender: TObject);');
  1890.       Inc(S);
  1891.       SourceStrings.Insert(S,'begin');
  1892.       Inc(S);
  1893.       SourceStrings.Insert(S,'  '+EditFormIdent+':= T'+EditFormIdent+'.Create(Self);');
  1894.       Inc(S);
  1895.       SourceStrings.Insert(S,'  Try');
  1896.       Inc(S);
  1897.       SourceStrings.Insert(S,'    '+Name+'.Ref:= '+BrowserName+'.GetCurrentDatRef;');
  1898.       Inc(S);
  1899.       SourceStrings.Insert(S,'    '+EditFormIdent+'.'+EditFormIdent+'Table:= IsamTable1;');
  1900.       Inc(S);
  1901.       SourceStrings.Insert(S,'    '+EditFormIdent+'.SetData;');
  1902.       Inc(S);
  1903.       SourceStrings.Insert(S,'    '+Name+'.FindKey('+RecordName+'Data,'+RecordName+'Dup,'+Name+'.Key);');
  1904.       Inc(S);
  1905.       SourceStrings.Insert(S,'    '+EditFormIdent+'.ShowModal;');
  1906.       Inc(S);
  1907.       SourceStrings.Insert(S,'  Finally');
  1908.       Inc(S);
  1909.       SourceStrings.Insert(S,'    Application.OnHint:= NIL;');
  1910.       Inc(S);
  1911.       SourceStrings.Insert(S,'    '+EditFormIdent+'.Free;');
  1912.       Inc(S);
  1913.       SourceStrings.Insert(S,'    '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1914.       Inc(S);
  1915.       SourceStrings.Insert(S,'  end;');
  1916.       Inc(S);
  1917.       SourceStrings.Insert(S,'end;');
  1918.       Inc(S);
  1919.     end;
  1920.   end;
  1921. end;
  1922.  
  1923. Procedure TIsamTable.SetSourceCreate(Const Value: Boolean);
  1924. Var SourceStrings : TStringlist;
  1925.     Formname      : String;
  1926.     R,S           : Integer;
  1927. begin
  1928.   if FSourceCreate <> Value then
  1929.   begin
  1930.     FSourceCreate := False;
  1931.     if FrecordName = '' then begin
  1932.       if Sprache = 1 then then Errorwindow('No Record-Name assigned','')
  1933.       else Errorwindow('Kein Recordname angegeben!','');
  1934.       exit;
  1935.     end;
  1936. {$ifndef Test}
  1937.     if not exist(FUnitName) then
  1938.     if not ToolServices.SaveProject then
  1939.     begin
  1940.       if Sprache = 1 then Errorwindow('Project could not be saved','')
  1941.       else ErrorWindow('Project konnte nicht','gespeichert werden');
  1942.       exit;
  1943.     end;
  1944.     SourceStrings:= TStringList.Create;
  1945.     Toolservices.SaveFile(FUnitName);
  1946.     SourceStrings.LoadFromFile(FUnitName);
  1947. {$Else}
  1948.     SourceStrings:= TStringList.Create;
  1949.     FUnitName := 'C:\Filer\t2.Pas';
  1950.     SourceStrings.LoadFromFile(FunitName);
  1951. {$Endif}
  1952.     if SourceStrings.Count > 0 then
  1953.     begin
  1954.       FormName:= GetFormName(SourceStrings);
  1955.  
  1956.       if Sprache = 1 then SErrorwindow('add USES','')
  1957.       else Serrorwindow('Uses einfⁿgen','');
  1958.       Uses_Einfuegen(SourceStrings);
  1959.  
  1960.       if Sprache = 1 then SErrorwindow('add RECORD','')
  1961.       else Serrorwindow('Record einfⁿgen','');
  1962.       Record_Einfuegen(SourceStrings);
  1963.  
  1964.       if Sprache = 1 then SErrorwindow('add DATA','')
  1965.       else Serrorwindow('Data einfⁿgen','');
  1966.       Data_Einfuegen(SourceStrings);
  1967.  
  1968.       if Sprache = 1 then SErrorwindow('add GETFELDPROC','')
  1969.       else Serrorwindow('Getfeldproc einfⁿgen','');
  1970.       GetFeldProc_Einfuegen(SourceStrings);
  1971.  
  1972.       if Sprache = 1 then SErrorwindow('add KEYPROC','')
  1973.       else Serrorwindow('Keyproc einfⁿgen','');
  1974.       Key_Proc_Einfuegen(SourceStrings);
  1975.  
  1976.       if Sprache = 1 then SErrorwindow('add KEY-declaration','')
  1977.       else Serrorwindow('KeyDeklaration einfⁿgen','');
  1978.       Key_Deklaration_Einfuegen(SourceStrings);
  1979.  
  1980.       if Sprache = 1 then then SErrorwindow('add FORMCREATE','')
  1981.       else Serrorwindow('FormCreate einfⁿgen','');
  1982.       FormCreate_Einfuegen(SourceStrings);
  1983.  
  1984.       if Sprache = 1 then SErrorwindow('fill FORMCREATE','')
  1985.       else Serrorwindow('FormCreate Fⁿllen einfⁿgen','');
  1986.       FormCreate_Fuellen(SourceStrings);
  1987.  
  1988.       if Sprache = 1 then SErrorwindow('fill FORMSHOW','')
  1989.       else Serrorwindow('FormShow Fⁿllen einfⁿgen','');
  1990.       FormShow_Fuellen(SourceStrings);
  1991.  
  1992.       if Sprache = 1 then SErrorwindow('fill FORMRESIZE','')
  1993.       else Serrorwindow('FormResize Fⁿllen einfⁿgen','');
  1994.       FormResize_Fuellen(SourceStrings);
  1995.  
  1996.       if Sprache = 1 then SErrorwindow('add HEADERCREATE','')
  1997.       else Serrorwindow('HeaderCreate einfⁿgen','');
  1998.       HeaderCreate_Einfuegen(SourceStrings);
  1999.  
  2000.       if Sprache = 1 then SErrorwindow('add BUILDROW','')
  2001.       else Serrorwindow('BuildRow einfⁿgen','');
  2002.       Browser_BuildRow_Einfuegen(SourceStrings);
  2003.  
  2004.       if Sprache = 1 then SErrorwindow('delete brackets','')
  2005.       else SErrorwindow('Klammern L÷schen','');
  2006.       Klammern_Loeschen(SourceStrings);
  2007.  
  2008.       if EditFormIdent <> '' then begin
  2009.         if Sprache = 1 then then SErrorwindow('BROWSER-Edit','')
  2010.         else SErrorwindow('Browser-Editoraufruf','');
  2011.         Browser_Edit_Einfuegen(SourceStrings);
  2012.       end;
  2013.  
  2014. {$ifdef Test}
  2015.        FUnitName := 'C:\Filer\t2.Pas';
  2016. {$EndIf}
  2017.       SourceStrings.SaveToFile(FUnitName);
  2018. {$IfNDef Test}
  2019.       MySave;
  2020. {$Endif}
  2021.     end;
  2022.     SourceStrings.Free;
  2023.   end;
  2024. end;
  2025.  
  2026. {Procedure TIsamTable.SetEditorCreate(const Value: Boolean);
  2027. begin
  2028.   FEditorCreate:= False;
  2029.   if csDesigning in ComponentState then begin
  2030.     if IsamRecord.Count > 0 then begin
  2031.       Try
  2032.         EditorExperte:= TEditorExperte.Create(Application);
  2033.         EditorExperte.FTable.IsamRecord.Assign(IsamRecord);
  2034.         EditorExperte.FTable.IsamKeyProc.Assign(IsamKeyProc);
  2035.         EditorExperte.FTable.RecordName:= RecordName;
  2036.         if EditorExperte.ShowModal = mrOk then EditFormIdent:= EditorExperte.FormIdent;
  2037.       Finally
  2038.         EditorExperte.Free;
  2039.       End;
  2040.     end
  2041.     else Errorwindow('Bitte zunΣchst Record definieren','');
  2042.   end;
  2043. end;}
  2044. {$ENDIF}
  2045.  
  2046. begin
  2047.   FHandle:= InitToolDll;
  2048.   NetType := NoNet;
  2049.   if __Netz = 'NONET' then NetType := NoNet;
  2050.   if __Netz = 'MSNET' then NetType := MsNet;
  2051.   if __Netz = 'NOVELLNET' then NetType := Novell;
  2052.   MyNet := NetType;
  2053. end.
  2054.  
  2055.  
  2056.